package com.NxIndustries.Sapphire;

import java.io.IOException;
import java.io.InputStream;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

import com.htc.configuration.HtcWrapConfiguration;
import com.htc.widget.ActionBarContainer;
import com.htc.widget.ActionBarExt;
import com.htc.widget.ActionBarText;

public class License extends Activity {
	private ActionBarExt actionBarExt=null;
   	private ActionBarText actionBarText=null;    
   	private ActionBarContainer actionBarContainer=null;
    
    public License() {
    	}
       
       public static int getHtcThemeID(Context context, int i)
       {
   		return HtcWrapConfiguration.getHtcThemeId(context, i);

       }
       private void SetupActionBar() {
           actionBarExt=new ActionBarExt(this,getActionBar());
           actionBarContainer=actionBarExt.getCustomContainer();
           actionBarText=new ActionBarText(this);    		        
   	    actionBarText.setPrimaryText("License");   
   	    actionBarContainer.addCenterView(actionBarText);
        }

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Context context = this;
		setTheme(getHtcThemeID(context, 0));
		setContentView(R.layout.agreement);
		SetupActionBar();
		loadChangeLog();
	}

	private void loadChangeLog() {
		TextView tv = (TextView) findViewById(R.id.logText);
		StringBuilder sb = new StringBuilder("");

		try {
			InputStream isr = getResources().openRawResource(R.raw.license);
			int c;
			while ((c = isr.read()) != -1)
				sb.append((char) c);
			isr.close();

		} catch (IOException e) {
		}

		tv.setText(sb.toString());
	}
}